package com.design.pattern.behavior.delegate.emp;

import java.util.HashMap;
import java.util.Map;

/**
 * Leader委派任务。
 */
public class Leader implements IEmployee{
    private Map<String, IEmployee> employeeMap = new HashMap<>();

    public Leader() {
        employeeMap.put("爬虫", new EmployeeA());
        employeeMap.put("网页", new EmployeeB());
    }

    @Override
    public void doing(String task) {
        if(!employeeMap.containsKey(task)) {
            System.out.println("这个任务"+ task +"超出了我的能力范围！");
            return;
        }
        employeeMap.get(task).doing(task);

    }
}
